import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { UserListComponent } from './user-list/user-list.component';
import { UsersComponent } from './users.component';
import { CanDeactivateGuardService } from '../core/guards/can-deactivate-guard.service';

// Routing for lazy loading.
const routes: Routes = [
    {
        path: 'users',
        component: UsersComponent,
        children: [
            {
                path: 'list',
                component: UserListComponent,
                canDeactivate: [CanDeactivateGuardService]
            }
            // {
            //     path: 'add/:id',
            //     // component: UserDetailComponent
            // },
            // {
            //     path: 'edit/:id',
            //     // component: UserDetailComponent
            // },
            // {
            //     path: 'detail/:id',
            //     // component: EditComponent
            // }
        ]
    }
];

@NgModule({
    // Always call RouterModule.forChild in a feature-routing module.
    imports: [RouterModule.forChild(routes)],
    exports: [RouterModule]
})
export class UsersRoutingModule { }